package com.hkw.daterangepicker;


import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.util.Log;

import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LifecycleRegistry;


public class BaseDialog extends Dialog implements LifecycleObserver, LifecycleOwner {
    private long currentTime;

    //private LoadingDialog dialog;

    protected LifecycleRegistry lifecycleRegistry = new LifecycleRegistry(this);

    public String tag = "BaseDialog";

    public BaseDialog(Context paramContext, int paramInt) {
        super(paramContext, paramInt);
    }

    public Lifecycle getLifecycle() {
        return (Lifecycle)this.lifecycleRegistry;
    }

    public String getManager_unique() {
        return getContext().getSharedPreferences("shop", 0).getString("managerUnique", "");
    }

    public String getShop_id() {
        return getContext().getSharedPreferences("shop", 0).getString("shopId", "");
    }

    public String getStaffPosition() {
        return getContext().getSharedPreferences("shop", 0).getString("staffPosition", "");
    }

    public void hideDialog() {
      /*  LoadingDialog loadingDialog = this.dialog;
        if (loadingDialog != null)
            loadingDialog.hideDialog();*/
    }

    public void hideSoftInput(Activity paramActivity) {
        //((InputMethodManager)paramActivity.getSystemService("input_method")).hideSoftInputFromWindow(paramActivity.getWindow().getDecorView().getWindowToken(), 0);
    }

    public boolean isQuicklyClick() {
        boolean bool;
        if (System.currentTimeMillis() - this.currentTime <= 500L) {
            bool = true;
            Log.e("111111", "is too quickly!");
        } else {
            bool = false;
        }
        this.currentTime = System.currentTimeMillis();
        return bool;
    }

    public void showDialog() {
       /* if (this.dialog == null)
            this.dialog = (new LoadingDialog.Builder(getContext())).setMessage(").setCancelable(true).setCancelOutside(true).create();
        this.dialog.showDialog();*/
    }

    public void showMessage(String paramString) {
        //ToastUtils.getInstance(getContext()).showMessage(paramString);
    }
}
